home *** CD-ROM | disk | FTP | other *** search
/ CICA 1995 August / CICA - The Ultimate Collection of Shareware for Windows (Disc 2) (August 1995).iso / disc2 / demo / pwrtcp11.exe / TNTSAMP.H_ / TNTSAMP.bin
Text File  |  1994-09-07  |  6KB  |  198 lines

  1. //---------------------------------------------------------------------------
  2. //
  3. //  Module: tty.h
  4. //
  5. //  Purpose:
  6. //     This is the header file for the TTY sample.
  7. //
  8. //---------------------------------------------------------------------------
  9. //
  10. //  Written by Microsoft Product Support Services, Windows Developer Support.
  11. //  Copyright (c) 1991 Microsoft Corporation.  All Rights Reserved.
  12. //
  13. //---------------------------------------------------------------------------
  14.  
  15. //***************************************************************************
  16. //
  17. //  Module: tntsamp.h
  18. //
  19. //  Purpose:
  20. //     The sample application demonstrates the usage of the PowerTCP
  21. //     API.  It uses the new PowerTCP DLL interface. Compiled under Windows 3.1
  22. //     and Windows NT 3.5 Beta
  23. //
  24. //     NOTE: This code was derived from Microsoft's tty.h
  25. //             
  26. //***************************************************************************
  27. //
  28. //  Written by Dart Communication Application Programming Group.
  29. //  Copyright (c) 1994 Dart Communications.  All Rights Reserved.
  30. //
  31. //***************************************************************************
  32.  
  33. #define USECOMM      // yes, we need the COMM API
  34.  
  35. // constant definitions
  36.  
  37. #define GWW_NPTTYINFO       0
  38. #define ABOUTDLG_USEBITMAP  1
  39.  
  40. #define ATOM_TTYINFO       0x100
  41.  
  42. // terminal size
  43.  
  44. #define MAXROWS         25
  45. #define MAXCOLS         80
  46.  
  47. #define MAXBLOCK        80
  48.  
  49. #define MAXLEN_TEMPSTR  81
  50.  
  51. #define RXQUEUE         4096
  52. #define TXQUEUE         4096
  53.  
  54. // cursor states
  55.  
  56. #define CS_HIDE         0x00
  57. #define CS_SHOW         0x01
  58.  
  59. // Flow control flags
  60.  
  61. #define FC_DTRDSR       0x01
  62. #define FC_RTSCTS       0x02
  63. #define FC_XONXOFF      0x04
  64.  
  65. // ascii definitions
  66.  
  67. #define ASCII_BEL       0x07
  68. #define ASCII_BS        0x08
  69. #define ASCII_LF        0x0A
  70. #define ASCII_CR        0x0D
  71. #define ASCII_XON       0x11
  72. #define ASCII_XOFF      0x13
  73.  
  74. // data structures
  75.  
  76. typedef struct tagTTYINFO
  77. {
  78.    int     idComDev ;
  79.    BYTE    bPort, abScreen[ MAXROWS * MAXCOLS ] ;
  80.    BOOL    fConnected, fXonXoff, fLocalEcho, fNewLine, fAutoWrap,
  81.            fUseCNReceive, fDisplayErrors;
  82.    BYTE    bByteSize, bFlowCtrl, bParity, bStopBits ;
  83.    WORD    wBaudRate, wCursorState ;
  84.    HFONT   hTTYFont ;
  85.    LOGFONT lfTTYFont ;
  86.    DWORD   rgbFGColor ;
  87.    int     xSize, ySize, xScroll, yScroll, xOffset, yOffset,
  88.            nColumn, nRow, xChar, yChar ;
  89.  
  90. } TTYINFO, *PTTYINFO ;
  91.  
  92. // macros ( for easier readability )
  93.  
  94. #define COMDEV( x ) (x -> idComDev)
  95. #define PORT( x )   (x -> bPort)
  96. #define SCREEN( x ) (x -> abScreen)
  97. #define CONNECTED( x ) (x -> fConnected)
  98. #define XONXOFF( x ) (x -> fXonXoff)
  99. #define LOCALECHO( x ) (x -> fLocalEcho)
  100. #define NEWLINE( x ) (x -> fNewLine)
  101. #define AUTOWRAP( x ) (x -> fAutoWrap)
  102. #define BYTESIZE( x ) (x -> bByteSize)
  103. #define FLOWCTRL( x ) (x -> bFlowCtrl)
  104. #define PARITY( x ) (x -> bParity)
  105. #define STOPBITS( x ) (x -> bStopBits)
  106. #define BAUDRATE( x ) (x -> wBaudRate)
  107. #define CURSORSTATE( x ) (x -> wCursorState)
  108. #define HTTYFONT( x ) (x -> hTTYFont)
  109. #define LFTTYFONT( x ) (x -> lfTTYFont)
  110. #define FGCOLOR( x ) (x -> rgbFGColor)
  111. #define XSIZE( x ) (x -> xSize)
  112. #define YSIZE( x ) (x -> ySize)
  113. #define XSCROLL( x ) (x -> xScroll)
  114. #define YSCROLL( x ) (x -> yScroll)
  115. #define XOFFSET( x ) (x -> xOffset)
  116. #define YOFFSET( x ) (x -> yOffset)
  117. #define COLUMN( x ) (x -> nColumn)
  118. #define ROW( x ) (x -> nRow)
  119. #define XCHAR( x ) (x -> xChar)
  120. #define YCHAR( x ) (x -> yChar )
  121. #define USECNRECEIVE( x ) (x -> fUseCNReceive)
  122. #define DISPLAYERRORS( x ) (x -> fDisplayErrors)
  123.  
  124. #define SET_PROP( x, y, z )  SetProp( x, MAKEINTATOM( y ), z )
  125. #define GET_PROP( x, y )     GetProp( x, MAKEINTATOM( y ) )
  126. #define REMOVE_PROP( x, y )  RemoveProp( x, MAKEINTATOM( y ) )
  127.  
  128. // global stuff
  129.  
  130. char     gszTTYClass[] = "TTYWndClass" ;
  131. char     gszAppName[] = "TTY" ;
  132. HACCEL   ghAccel ;
  133. UINT     gawBaudTable[] = { CBR_110,
  134.                             CBR_300,
  135.                             CBR_600,
  136.                             CBR_1200,
  137.                             CBR_2400,
  138.                             CBR_4800,
  139.                             CBR_9600,
  140.                             CBR_14400,
  141.                             CBR_19200,
  142.                             CBR_38400,
  143.                             CBR_56000,
  144.                             CBR_128000,
  145.                             CBR_256000   } ;
  146.  
  147. WORD     gawParityTable[] = { NOPARITY,
  148.                               EVENPARITY,
  149.                               ODDPARITY,
  150.                               MARKPARITY,
  151.                               SPACEPARITY } ;
  152.  
  153. WORD     gawStopBitsTable[] = { ONESTOPBIT,
  154.                                 ONE5STOPBITS,
  155.                                 TWOSTOPBITS } ;
  156.  
  157. // function prototypes (private)
  158.  
  159. BOOL InitApplication( HINSTANCE ) ;
  160. HWND InitInstance( HINSTANCE, int ) ;
  161. LRESULT CreateTTYInfo( HWND ) ;
  162. BOOL DestroyTTYInfo( HWND ) ;
  163. BOOL ResetTTYScreen( HWND ) ;
  164. BOOL KillTTYFocus( HWND ) ;
  165. BOOL PaintTTY( HWND ) ;
  166. BOOL SetTTYFocus( HWND ) ;
  167. BOOL ScrollTTYHorz( HWND, WORD, WORD ) ;
  168. BOOL ScrollTTYVert( HWND, WORD, WORD ) ;
  169. BOOL SizeTTY( HWND, WORD, WORD ) ;
  170. BOOL ProcessTTYCharacter( HWND, BYTE ) ;
  171. BOOL WriteTTYBlock( HWND, LPBYTE, int ) ;
  172. int ReadCommBlock( HWND, LPSTR, int ) ;
  173. BOOL WriteCommByte( HWND, BYTE ) ;
  174. BOOL MoveTTYCursor( HWND ) ;
  175. BOOL OpenConnection( HWND ) ;
  176. //BOOL NEAR SetupConnection( HWND ) ;
  177. BOOL CloseConnection( HWND ) ;
  178. BOOL GoModalDialogBoxParam( HINSTANCE, LPCSTR, HWND, DLGPROC, LPARAM ) ;
  179. VOID FillComboBox( HINSTANCE, HWND, int, WORD *, WORD, WORD ) ;
  180. BOOL SelectTTYFont( HWND ) ;
  181. BOOL SettingsDlgInit( HWND ) ;
  182. BOOL SettingsDlgTerm( HWND ) ;
  183.  
  184. // function prototypes (public)
  185. #ifdef __cplusplus
  186. extern "C" {
  187. #endif
  188. LRESULT CALLBACK TTYWndProc( HWND, UINT, WPARAM, LPARAM ) ;
  189. BOOL CALLBACK AboutDlgProc( HWND, UINT, WPARAM, LPARAM ) ;
  190. #ifdef __cplusplus
  191. }
  192. #endif
  193.  
  194. //---------------------------------------------------------------------------
  195. //  End of File: tty.h
  196. //---------------------------------------------------------------------------
  197.  
  198.